<template>
	<view >	
	<view class="">
			<uni-forms :modelValue="formData">
				<uni-forms-item label="群名称" name="name">
					<uni-easyinput type="text" v-model="formData.name" placeholder="请输入群名称" />
				</uni-forms-item>
			<!-- 	<uni-forms-item required name="[hobby,hhhh]" label="兴趣爱好">
					<uni-data-checkbox multiple v-model="formData.hobby" :localdata="hobby" />
				</uni-forms-item> -->
			</uni-forms>
			<button @click="submitForm">Submit</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				formData: {
								name: '',
	
							}

			}
		},
		methods: {
			validateForm() {
			      this.$refs.forms.validate(valid => {
			        if (valid) {
			          this.submitForm();
			        } else {
			          uni.showToast({
			            title: '请填写正确的信息',
			            icon: 'none'
			          });
			        }
			      });
			    },
			    submitForm() {
					console.log(this.formData)
			      // 表单提交逻辑
				  this.$http({
					  url: '/bbservice/bbgroup/createGroup' ,
					  method: 'POST',
					  data: {
						  name: this.formData.name,
						  token: uni.getStorageSync('localtoken'),
						  roles: '0'
					  }
				  }).then(res=>{
					  
					  uni.showToast({
					    title: '表单提交成功',
					    icon: 'success',
						duration: 3000
					  });
					  setTimeout(function() {
					  	uni.hideLoading();
					  	uni.switchTab({
					  		url: '/pages/group/group'
					  	})
					  }, 3000)
				  })
			   
			    }
			  

		}
	}
</script>

<style>


</style>